package br.usp.ime.origami.foldcut.packing;

import java.io.FileNotFoundException;

import br.usp.ime.origami.foldcut.gui.Screen;
import br.usp.ime.origami.foldcut.gui.canvas.FirstPhaseCanvas;
import br.usp.ime.origami.foldcut.gui.listener.FirstPhaseDiskPositioningMouseListener;
import br.usp.ime.origami.foldcut.io.Reader;
import br.usp.ime.origami.foldcut.structures.simplegraph.Graph;

public class Main2
{

	public static void main(String[] args) throws FileNotFoundException
	{

		if (args.length == 0)
		{
			throw new IllegalArgumentException("needs file name");
		}

		Graph grafo = Reader.read(args[0]);

		FirstPhaseManualPacker packer = new FirstPhaseManualPacker(grafo);
		packer.automaticVertexPacking();
		
		FirstPhaseCanvas canvas = new FirstPhaseCanvas();
		FirstPhaseDiskPositioningMouseListener listener = new FirstPhaseDiskPositioningMouseListener(packer, canvas);
		
		canvas.setSize(800, 800);
		canvas.addMouseListener(listener);
		canvas.addMouseMotionListener(listener);
		canvas.setVisible(true);
		
		Screen screen = new Screen(packer);
		screen.setCanvas(canvas);
	}
}
